package com.biyesheji.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.biyesheji.domain.Employee;
import com.biyesheji.dao.EmployeeMapper;
import com.biyesheji.service.IEmployeeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 员工信息 服务实现类
 * </p>
 *
 * @author 崔
 * @since 2023-02-12
 */
@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements IEmployeeService {

    @Override
    public List<Employee> getEmployeeList(String employeePhone, Integer status) {
        LambdaQueryWrapper<Employee> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(employeePhone != null&& !employeePhone.equals("-1"), Employee::getPhone, employeePhone);
        queryWrapper.eq(status != null && status != 2, Employee::getStatus, status);
        queryWrapper.orderByDesc(Employee::getUpdateTime);
        List<Employee> list = this.list(queryWrapper);


        return list;
    }

}
